<html>
<head>
<style type='text/css'>
body {
   background-color: white;
   margin: 1em 2em 1em 2em;
   font-family: Sans-Serif;
   color: #002;
   line-height: 140%;
   font-size: 12px;
}

h1 {
    font-size: 140%;
}

h2 {
    font-size: 130%;
}

h3 {
    font-size: 120%;
}

h4 {
    font-size: 100%;
    font-style: normal;
    font-weight: bold;
}

h5 {
    font-size: 100%;
    font-style: italic;
    font-weight: normal;
}

pre {
   background-color: #eee;
   padding: 0.5em 0.5em 0.5em 2em;
}

@media print {
   pre {word-wrap:break-word; width:100%;}
} 

ul li,
ol li {
   padding-left: 0.3em;
   /*text-indent: -2em;*/
   margin-bottom: 0.5em;
}

em {
   font-style: normal;
   font-weight: bold;
   text-decoration: underline;
   color: #c40;
}

code {
   font-family: Monospace;
   font-size: 100%;
   color: #c40;
}

a, a * {
   text-decoration: underline;
   color: #14a0d1;
   /* border: 0.5px solid #aaa;
   white-space: nowrap;
   padding-right: 0.1em;
   padding-left: 0.1em;
   padding-bottom: -5px; */
}

a code {
   color: #14a0d1;
}

img {
   position: relative;
   bottom: -4px;
}

div.headline {
   font-weight: bold;
   font-size: 110%;
}

div.copyright {
   margin-top: 1em;
   border-top: 1px solid black;
   padding-top: 0.5em;
}

div.iris_headline {
   border-bottom: 1px solid black;
   padding-bottom: 0.3em;
}

.LaTeX {
   font-family: Monospace;
   font-size: 100%;
   border: 1px solid #060;
   color: #060;
}

code.LaTeX {
   background-color: white;
   padding: 0.5em 0.5em 0.5em 2em;
}
</style>
</head>

<body>
<div class="iris_headline">IRIS Toolbox Reference Manual</div>




<h2 id="dbase/dbfun">dbfun</h2>
<div class="headline">Apply function to database fields</div>

<h4 id="syntax">Syntax</h4>
<p>Input arguments marked with a <code>~</code> (tilde) sign may be omitted.</p>
<pre><code>[D,Flag,ErrList,WarnList] = dbfun(Func,D,...)
[D,Flag,ErrList,WarnList] = dbfun(Func,D,~D2,~D3,...,~Dk,...)</code></pre>
<h4 id="input-arguments">Input arguments</h4>
<ul>
<li><p><code>Func</code> [ function_handle | char ] - Function that will be applied to each field.</p></li>
<li><p><code>D</code> [ struct ] - Primary input database whose fields will be processed by the function <code>Func</code>.</p></li>
<li><p><code>~D2</code>, <code>~D3</code>, ... [ struct ] - Secondary input databases whose fields will be passed into <code>Func</code> (<code>Func</code> accepts more than one input argument).</p></li>
</ul>
<h4 id="output-arguments">Output arguments</h4>
<ul>
<li><p><code>D</code> [ struct ] - Output database whose fields will be created by applying <code>Func</code> to each field of the input database or databases.</p></li>
<li><p><code>Flag</code> [ <code>true</code> | <code>false</code> ] - True if no error occurs when evaluating the function.</p></li>
<li><p><code>ErrList</code> [ cellstr ] - List of fields on which the function has thrown an error.</p></li>
<li><p><code>WarnList</code> [ cellstr ] - List of fields on which the function has thrown a warning.</p></li>
</ul>
<h4 id="options">Options</h4>
<ul>
<li><p><code>'subdbase='</code> [ <em><code>true</code></em> | <code>false</code> ] - Go through all sub-databases (i.e. struct fields within the input struct), applying the function <code>Func</code> to their fields, too.</p></li>
<li><p><code>'classFilter='</code> [ cell | cellstr | rexp | <em><code>@all</code></em> ] - Apply <code>Func</code> only to database fields whose class is on the list or matches the regular expression; <code>@all</code> means all fields in the input database <code>D</code> will be processed.</p></li>
<li><p><code>'fresh='</code> [ <code>true</code> | <em><code>false</code></em> ] - Remove unprocessed entries from the output database.</p></li>
<li><p><code>'nameList='</code> [ cell | cellstr | rexp | <em><code>@all</code></em> ] - Apply <code>Func</code> only to this list of database field names or names that match this regular expression; <code>@all</code> means all entries in the input database <code>D</code> wil be processed.</p></li>
<li><p><code>'ifError='</code> [ <code>'NaN'</code> | <em><code>'remove'</code></em> ] - What to do with the database entry if an error occurs when the entry is being evaluated.</p></li>
<li><p><code>'ifWarning='</code> [ <em><code>'keep'</code></em> | <code>'NaN'</code> | <code>'remove'</code> ] - What to do with the database entry if an error occurs when the entry is being evaluated.</p></li>
</ul>
<h4 id="description">Description</h4>
<h4 id="example">Example</h4>
<pre><code>d = struct( );
d.a = [1, 2];
d.b = tseries(1:3,@ones);
d = dbfun( @(x) 2*x, d)

d = 
    a: [2 4]
    b: [3x1 tseries]

d.b
ans = 
    tseries object: 3-by-1
    1:  2
    2:  2
    3:  2
    &#39;&#39;
    user data: empty
    export files: [0]</code></pre>

</body>
<div class="copyright">IRIS Toolbox. Copyright &copy; 2007-2015 IRIS Solutions Team.</div>
</html>
